package com.vf.cloud.paas.common.log.event;

import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;

import com.vf.cloud.paas.app.master.api.sys.service.IUserLog;
import com.vf.cloud.paas.app.master.common.domain.UserLog;

import lombok.RequiredArgsConstructor;

/**
 * 异步监听日志事件
 */
@RequiredArgsConstructor
public class RLogListener {

	private final IUserLog userLogImpl;

	@Async
	@Order
	@EventListener(RLogEvent.class)
	public void saveSysLog(RLogEvent event) {
		UserLog sysLog = (UserLog) event.getSource();
		userLogImpl.saveLog(sysLog);
	}

}
